const libs  = include('libs/libs')
const _ = libs.$lodash;

function *hello(oridata) {

    var method = this.method;

    var _this = this,
        method = this.method,
        location = this.local;

    if (method === 'GET') {
        // var kkk = libs.uri(location.query)
        // if (location.query.login){
        //     this.session.login = location.query.login;
        // }
        // else {
        //     if (this.session.login){
        //         var login = this.session.login;
        //         var _query = _.cloneDeep(location.query);
        //         var _hash;
        //         _query = _.assign(_query, {login: login})
        //         delete _query.openid;
        //
        //         if (_query.reurl){
        //             _hash = _query.reurl
        //             delete _query.reurl
        //         }
        //
        //         var rct_query = libs.querystring.stringify(_query)
        //         var rct  = '/app?'+rct_query;
        //         rct = libs.querystring.unescape(rct)
        //         console.log('========== rct');
        //         console.log('========== rct');
        //         console.log('========== rct');
        //         console.log('========== rct');
        //         console.log(rct);
        //         rct = rct+'#'+_hash
        //         this.redirect(rct)
        //     }
        // }
        return oridata;
    }

    if (method === 'POST') {
        // var body = yield libs.$parse(this);
        // if (body){
        //     if (body.login){
        //         this.session.login = body.login
        //     }
        // }
        return {success: 'true'};
    }

}

module.exports = {
    getData : hello
}
